home *** CD-ROM | disk | FTP | other *** search
- ' GETRIGHT.BAS
- ' This program demonstrates the RIGHT$ function.
-
- CLS
-
- alphabet$ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ' declare test string
-
- PRINT "How many characters (from right to left) in the following"
- PRINT "string would you like to display?"
- PRINT
- PRINT alphabet$ ' display test string
- PRINT
-
- ' get from user number of rightmost characters to be displayed
- DO ' loop until number is in proper range (1 through 26)
- INPUT " Number (1-26): ", rightNum%
- LOOP WHILE (rightNum% < 1) OR (rightNum% > 26)
-
- PRINT
- rightChar$ = RIGHT$(alphabet$, rightNum%) ' display characters
- PRINT "You specified"; LEN(rightChar$); "characters: "; rightChar$
-
-